#build
FROM node:alpine
ARG API_SERVER=:14000
RUN mkdir -p /var/www
WORKDIR /var/www
ENV REACT_APP_API_SERVER ${API_SERVER}
COPY package.json /var/www/
RUN yarn config set registry 'https://registry.npm.taobao.org' 
RUN yarn 
COPY src /var/www/src
COPY public /var/www/public
COPY config /var/www/config
RUN ls
RUN echo REACT_APP_API_SERVER: $REACT_APP_API_SERVER  
RUN yarn build

#ship
FROM nginx:1.13.5-alpine
COPY --from=0 --chown=nginx:nginx /var/www/build /usr/share/nginx/html
COPY --chown=nginx:nginx nginx-static.conf /etc/nginx/conf.d/default.conf

EXPOSE 80